<?php

namespace App\Models\Stock;

use App\Enum;
use App\Models\BaseModel;
use App\Models\Basic\Storage;

class StockTransfer extends BaseModel
{
    protected $fillable = [
        'transfer_no',
        'out_storage_id',
        'in_storage_id',
        'remarks',
    ];

    protected $hidden = [
    ];

    public function outStorage()
    {
        return $this->belongsTo(Storage::class, 'out_storage_id');
    }

    public function inStorage()
    {
        return $this->belongsTo(Storage::class, 'in_storage_id');
    }


    public function stockTransferItems()
    {
        return $this->hasMany(StockTransferItem::class,'transfer_id','id')->where('is_enable',Enum::IS_ENABLE_TRUE);
    }


}